package Class_04_12;
//案例2:
//网购已成为人们生活的重要组成部分，当人们在购物网站中下订单后，订单中的货物就会在经过一系列的流程后，送到客户的手中。
//而在送货期间，物流管理人员可以在系统中查看所有物品的物流信息。
//编写一个模拟物流快递系统的程序，模拟后台系统处理货物的过程。

//定义交通工具类
abstract class Transportation
{
    private String number;  //编号
    private String model;   //型号
    private String admin;   //运货人

    public Transportation() {
    }

    public Transportation(String number, String model, String admin) {
        this.number = number;
        this.model = model;
        this.admin = admin;
    }

    public String getNumber() {
        return number;
    }

    public void setNumber(String number) {
        this.number = number;
    }

    public String getModel() {
        return model;
    }

    public void setModel(String model) {
        this.model = model;
    }

    public String getAdmin() {
        return admin;
    }

    public void setAdmin(String admin) {
        this.admin = admin;
    }

    //运输方法
    abstract void transport();
}

//货车准备接口
interface preparation
{
    void inspect();
}

//定位接口
interface GPS
{
    String showAddress();
}

//定义用户手机类查看信息
class phone implements GPS
{
    public phone() {
    }

    public String showAddress()
    {
        String location = "无锡";
        return location;
    }
}

//运输车1
class truck extends Transportation implements preparation
{
    public truck() {
    }

    public truck(String number, String model, String admin) {
        super(number, model, admin);
    }

    public void transport()
    {
        System.out.println("正在运输中...");
    }

    public void inspect()
    {
        System.out.println("车辆出发前检查已完毕");
    }
}

//货物类
class goods
{
    private String ID;  //订单号
    private double weight; //重量

    public goods() {
    }

    public goods(String ID, double weight) {
        this.ID = ID;
        this.weight = weight;
    }

    public String getID() {
        return ID;
    }

    public void setID(String ID) {
        this.ID = ID;
    }

    public double getWeight() {
        return weight;
    }

    public void setWeight(double weight) {
        this.weight = weight;
    }

    public void Be_Sending()
    {
        System.out.println("订单已由商家确定，正在仓库中分拣");
        System.out.println("商品分拣完成，正在验货...");
        System.out.println("货物检验完成！");
        System.out.println("货物重量为：" + getWeight() + "kg");
        System.out.println("货物已完成装车！");
        System.out.println("订单号为：" + getID());
    }

    //运输中
    public void Mid_Sending(Transportation t, GPS tool)
    {
        System.out.println("运货人" + t.getAdmin() + "正在驾驶编号为" + t.getNumber() + "的" + t.getModel() + "为您送货");
        System.out.println("货物当前在" + tool.showAddress());
    }

    //运输后
    public void Af_Sending()
    {
        System.out.println("该货物已运输完成！");
        System.out.println("请您注意签收货物！");
    }
}
public class Main2 {
    public static void main(String[] args) {
        //定义货物对象
        goods goods1 = new goods("YT56412",1.6);
        goods1.Be_Sending();
        System.out.println("==================================");

        //定义运输类对象
        truck t1 = new truck("T001","半挂","小刚");
        //定义手机类
        phone p1 = new phone();
        goods1.Mid_Sending(t1,p1);
        System.out.println("====================================");
        goods1.Af_Sending();
    }
}
